package com.oms.app.sequence.dao.impl;

import com.oms.app.sequence.dao.ISequenceDAO;
import com.oms.app.sequence.model.Sequence;
import com.oms.core.dao.impl.GeneralDAO;

/**
 * @author Loong_Mit
 * @date Sep 5, 2012 8:32:02 PM
 */

public class SequenceDAOImpl extends GeneralDAO<Sequence, String> implements ISequenceDAO {

	@Override
	public Sequence getSequence(String tableName) {
		return (Sequence) this.queryForObject("getSequenceId", tableName);
	}

	@Override
	public void insertSequence(String tableName) {
		Sequence sequence = new Sequence(10000, tableName);
		this.insert(sequence);
	}

	@Override
	public int updateSequence(Sequence sequence) {
		this.update("updateSequence", sequence);
		return 1;
	}
}